/**
 * Created by Administrator on 20213/21.
 * district Model 章节信息
 */
let DbInit = require('./DbInit');
let sequelize = DbInit.sequelize;
let Sequelize=DbInit.seqobj;
let statistic = sequelize.define('statistic', {

    id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        primaryKey: true
    },
    bookid:{//书籍id
        type: Sequelize.STRING(30),
        primaryKey:true,
        allowNull:false
    },    
    bookname:{//书籍id
        type: Sequelize.STRING(50),        
        allowNull:false
    },
    author: {//书本作者
        type: Sequelize.STRING(100),
        allowNull:true
    },
    type: {//支付类型
        type: Sequelize.TEXT,
        allowNull:true
    },
    price:{//定价
        type: Sequelize.FLOAT(10,2),
        allowNull:true,
        defaultValue:0
    },
    amounttotal:{//金额合计
        type: Sequelize.BIGINT(10),
        allowNull:true,
        defaultValue:0
    },
    paymentcount:{//付费次数合计
        type: Sequelize.BIGINT(10),
        allowNull:true,
        defaultValue:0
    },
    paymentratio:{//付费次数合计
        type: Sequelize.FLOAT(10,2),
        allowNull:true,
        defaultValue:0
    },
    averageratio:{//付费次数合计
        type: Sequelize.FLOAT(10,2),
        allowNull:true,
        defaultValue:0
    },
    pvtotal:{//当日合计pv
        type: Sequelize.BIGINT(10),
        allowNull:true,
        defaultValue:0
    },
    date:{
        type: Sequelize.STRING(50),
        allowNull:true
    },
    status:{
        type: Sequelize.CHAR(1),
        allowNull:true
    }

}, {
    createdAt: 'creattime',
    updatedAt:'updatetime',
    charset: 'utf8',
    collate: 'utf8_general_ci',
    freezeTableName: true // Model 对应的表名将与model名相同
});


statistic.sync({ alter: true })
module.exports = statistic;